/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Raytracing.Shaders;

import Raytracing.Constants;
import processing.core.PVector;

/**
 *
 * @author Matt
 */
public class StripeProvider extends TextureProvider {

    private float gridSize = 500;
    private float gridRes = 50;
    PVector sheetColor = new PVector(1f, 1f, 1f);
    PVector gridColor = new PVector(0f, 0f, 0f);

    private float angle = 3.14f/4.f;
    

    
    public StripeProvider(PVector color){
        sheetColor = color;
        angle = 0;
    }
    
    public void setScale(float scale){
        gridSize = 2000*scale;
        
    }
    public void getColor(float u, float v, PVector ret) {
        
        //rotate the v coordinate
        //by angle radians
        v = (float)(u*Math.sin(angle) + v*Math.cos(angle));
        
        if ((v * gridSize % 100) < gridRes) {
            ret.set(gridColor);
        } else {
            ret.set(sheetColor);
        }
    }
}
